var heartBeatIntervalMs=5000;var maxCheckAttempts=3;var heartBeatEventsCounter=0;var heartBeatStatus="";var heartBeatInterval=heartBeatIntervalMs;var errorList={"ERROR(701)":"true","ERROR(702)":"true","ERROR(703)":"true","ERROR(704)":"true","ERROR(705)":"true","ERROR(706)":"true"};(function(){var count=0;var checkSdk=function(ctx){var waitTimeout=250;if(typeof cdApi==="object"){cdApi.changeContext(ctx);triggerUiWebServerLogger("BehBio SDK is loaded for change context function with pageContext",":"+ctx)}else{if(count<=60){if(count>40){waitTimeout=1000}var multipler=count>40?count-30:count;triggerUiWebServerLogger("BehBio SDK is not loaded for change context function in miliseconds",":"+multipler*waitTimeout);window.setTimeout(function(){checkSdk(ctx)},waitTimeout);count=count+1}}};var vendbJSLoadPromise=new Promise((resolve,reject)=>{var scriptTag=document.getElementById("vendb-js");if(!scriptTag)return reject();scriptTag.addEventListener("load",()=>resolve());scriptTag.addEventListener("error",()=>reject())});var startListen=function(){_setHeartBeatListener();setInterval(_checkHeartBeatStatus.bind(this),this.heartBeatInterval)};var _checkHeartBeatStatus=function(){var ahvcCookieHeartBeat="";document.cookie.split("; ").forEach(function(row){if(row.startsWith("AHVC=")){ahvcCookieHeartBeat=row}});var ahvcCookieHeartBeatValue=ahvcCookieHeartBeat.split("invokeHeartBeat:")[1].split(":")[0];if(ahvcCookieHeartBeatValue==="true"){this.maxCheckAttempts-=1;if(this.maxCheckAttempts===0&&this.heartBeatEventsCounter===0){_sendheartbeatapifailureStatus("sdkBlocked")}if(this.heartBeatStatus==="Ok"){}else if(typeof this.heartBeatStatus==="object"){for(var errorCode in this.errorList){if(this.errorList[errorCode]==="true"){this.heartBeatStatus.forEach(function(code){if(code===errorCode){this.errorList[errorCode]="false";_sendheartbeatapifailureStatus()}})}}}}};var _sendheartbeatapifailureStatus=function(error){var captureJsStatusLocation=window.location.host;var captureJsStatusUrl="";if(captureJsStatusLocation.indexOf("secure")>-1){captureJsStatusUrl="https://"+captureJsStatusLocation+"/login/rest/sas/sparta/v1/captureJsStatus"}else{var unsecureUrlLocation=captureJsStatusLocation.replace("www","secure");captureJsStatusUrl="https://"+unsecureUrlLocation+"/login/rest/sas/sparta/v1/captureJsStatus"}var requestPayload="";if(error==="sdkBlocked"){requestPayload={jsstatus:["ERROR(699)"]}}else{requestPayload={jsstatus:this.heartBeatStatus}}var request=new XMLHttpRequest;request.open("POST",captureJsStatusUrl,true);request.setRequestHeader("Content-type","application/json");request.setRequestHeader("accept","application/json");request.setRequestHeader("cache-control","no-cache");request.send(JSON.stringify(requestPayload))};var triggerUiWebServerLogger=function(message,param){var uiLoggerLocation=window.location.host;var encryptedMessage=btoa(message);var encryptedHref=btoa(window.location.href);if(param===undefined){param=""}const appendErrorUrl="?m="+encryptedMessage+param+"&r="+encryptedHref;var uiLoggerUrl="";if(uiLoggerLocation.indexOf("secure")>-1){uiLoggerUrl="https://"+uiLoggerLocation+"/sparta/client/helper/client-assets/"}else{var unsecureUrlLocation=uiLoggerLocation.replace("www","secure");uiLoggerUrl="https://"+unsecureUrlLocation+"/sparta/client/helper/client-assets/"}var request=new XMLHttpRequest;request.open("GET",uiLoggerUrl+appendErrorUrl,true);request.setRequestHeader("Content-type","application/json");request.setRequestHeader("accept","application/json");request.setRequestHeader("cache-control","no-cache");request.send()};var _setHeartBeatListener=function(){window.addEventListener("message",event=>{if(event.data.type==="cdHeartbeat"){this.heartBeatEventsCounter+=1;this.heartBeatStatus=event.data.data}})};window.initiateRequest=function(adrUrl,request){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("POST",adrUrl,true);xhr.setRequestHeader("Content-type","application/json");xhr.setRequestHeader("accept","application/json");xhr.setRequestHeader("cache-control","no-cache");xhr.onreadystatechange=()=>{if(xhr.readyState===XMLHttpRequest.DONE){const status=xhr.status;if(status===200){resolve(xhr.responseText)}else{reject("request Failed!")}}};xhr.send(request)})};var ddo=window.digitalData;window.ah_context=function(context){let ctx=context;checkSdk(ctx)};window.collectDeviceData=function(flow,inauthPayload){var pageLocation=window.location.host;var adrUrl="https://"+pageLocation+"/login/rest/sas/sparta/v1/adr";var domData="";if(document.getElementById("_ia")){domData=document.getElementById("_ia").value}var requestPayload={"filterRules":[{"name":"flow","value":flow||"account_opening"},{"name":"inAuthPayload","value":inauthPayload||domData}]};return new Promise(resolve=>{window.initiateRequest(adrUrl,JSON.stringify(requestPayload)).then(data=>{const responseJSON=JSON.parse(data);resolve(responseJSON)}).catch(error=>{resolve(error)})})};window.startSession=function(){var ahvcCookieStartSession="";document.cookie.split("; ").forEach(function(row){if(row.startsWith("AHVC=")){ahvcCookieStartSession=row}});var sessionRefreshCookie=ahvcCookieStartSession.split("sessionRefresh:")[1];var ahvcCookieStartSessionValue="";if(sessionRefreshCookie){ahvcCookieStartSessionValue=sessionRefreshCookie.split(":")[0]}if(ahvcCookieStartSessionValue==="true"){if(typeof cdApi==="object"){cdApi.startNewSession()}}};var getSCookie=function(name){var re=new RegExp("[; ]"+name+"=([^\\s;]*)"),matches=null;if(document.cookie.length>0){matches=document.cookie.match(re);if(matches&&matches.length===2){return decodeURIComponent(matches[1])}}};var glacier=function(){var result={c:getSCookie("SID")};return result};var pageUrl=window.location.href;var urlLocation=window.location.host;var isZelle=pageUrl.indexOf("/transfers/")>-1;var isABPA=pageUrl.indexOf("/apply-credit-cards/")>-1||pageUrl.indexOf("/apply-deposits/")>-1||pageUrl.indexOf("/credit-cards/")>-1||pageUrl.indexOf("/business-financing/")>-1||pageUrl.indexOf("/business-lending/")>-1||pageUrl.indexOf("/applynow/")>-1||pageUrl.indexOf("/deposits/")>-1||pageUrl.indexOf("/usa/")>-1||pageUrl.indexOf("/uasb/")>-1;var iaUrl="";var pageContext="";if(ddo.page!=undefined&&ddo.page.pageInfo!=undefined&&ddo.page.pageInfo[0]!=undefined&&ddo.page.pageInfo[0].pageID!=undefined){pageContext=ddo.page.pageInfo[0].pageID}else{pageContext="PageId Not Found"}if(urlLocation.indexOf("secure")>-1){iaUrl="https://"+urlLocation+"/login/rest/sas/sparta/v2/iac"}else{var unsecureUrlLocation=urlLocation.replace("www","secure");iaUrl="https://"+unsecureUrlLocation+"/login/rest/sas/sparta/v2/iac"}if(isABPA){(function(){if(document.readyState==="complete"||document.readyState==="interactive"){window.boa=window.boa||{};window.boa.fingerprint=window.boa.fingerprint||{};var ns=window.boa.fingerprint;var counter=0;ns.config={collector:{src:window.ccPath||iaUrl+"?dfp=false",async:true,flags:window.flagsToCollect||155687923},formIdentifier:window.formIdentifier||"collector-form-marker",inputname:"_ia",submitBtnSelector:window.__submitBtnSelector||"a.btn-bofa-blue[name=enter-online-id-submit]"};ns.init=function(){window._cc=window._cc||[];_cc.push(["bfdc",[3,100,15]]);_cc.push(["ci",{"sid":"0602497b-ac9e-40d3-88f0-6501ae64e714","tid":"5678"}]);_cc.push(["cf",ns.config.collector.flags]);_cc.push(["run",("https:"==document.location.protocol?"https://":"http://")+"www.bankofamerica.com"]);var scriptCollector=document.createElement("script");scriptCollector.setAttribute("src",ns.config.collector.src);scriptCollector.setAttribute("async",ns.config.collector.async);scriptCollector.setAttribute("flags",ns.config.collector.flags);document.getElementsByTagName("head")[0].appendChild(scriptCollector);scriptCollector.onload=function(){var csidCookie="";document.cookie.split("; ").forEach(function(row){if(row.startsWith("CSID=")){csidCookie=row}});if(typeof cdApi==="object"){if(csidCookie){var csidCookieValue=csidCookie.split(":")[0].split("CSID=")[1];cdApi.setCustomerSessionId(csidCookieValue)}cdApi.changeContext(pageContext);triggerUiWebServerLogger("BehBio SDK is loaded with csid and pageContext",":"+csidCookieValue+":"+pageContext)}else{vendbJSLoadPromise.then(()=>{cdApi.changeContext(pageContext);if(csidCookie){var csidCookieValue=csidCookie.split(":")[0].split("CSID=")[1];cdApi.setCustomerSessionId(csidCookieValue)}triggerUiWebServerLogger("BehBio SDK is loaded with csid and pageContext",":"+csidCookieValue+":"+pageContext)})}};var inputCollector=document.createElement("input");inputCollector.setAttribute("type","hidden");inputCollector.setAttribute("name",ns.config.inputname);inputCollector.setAttribute("id",ns.config.inputname+"ID");if(document.getElementsByClassName(ns.config.formIdentifier).length>0){document.getElementsByClassName(ns.config.formIdentifier)[0].appendChild(inputCollector)}};ns.prepareIAData=function(callback){if(window._cc.loaded===!0){if(window._cc&&window._cc.loaded===!0&&window.boa&&window.boa.fingerprint&&boa.fingerprint.config&&boa.fingerprint.config.inputname){_cc.push(["cfp",function(payload){if(document.getElementById(boa.fingerprint.config.inputname+"ID")){document.getElementById(boa.fingerprint.config.inputname+"ID").value=payload}if(callback){callback(payload)}}])}else{if(callback){callback()}}}else{if(counter<10){window.setTimeout(function(){ns.prepareIAData(callback)},1000);counter=counter+1}else{if(callback){callback()}}}};startListen();ns.init()}})()}else{var csidCookie="";document.cookie.split("; ").forEach(function(row){if(row.startsWith("CSID=")){csidCookie=row}});if(typeof cdApi==="object"){if(csidCookie){var csidCookieValue=csidCookie.split(":")[0].split("CSID=")[1];cdApi.setCustomerSessionId(csidCookieValue)}cdApi.changeContext(pageContext);triggerUiWebServerLogger("BehBio SDK is loaded with csid and pageContext",":"+csidCookieValue+":"+pageContext)}else{vendbJSLoadPromise.then(()=>{cdApi.changeContext(pageContext);if(csidCookie){var csidCookieValue=csidCookie.split(":")[0].split("CSID=")[1];cdApi.setCustomerSessionId(csidCookieValue)}triggerUiWebServerLogger("BehBio SDK is loaded with csid and pageContext",":"+csidCookieValue+":"+pageContext)})}startListen()}})(); //# sourceMappingURL=./auth.js.map